home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / toasterpaint / iff2clip.rexx < prev    next >
OS/2 REXX Batch file  |  1995-12-22  |  4KB  |  165 lines

  1. /* IFF2Clip.rexx V2.05 -- Turns a series of IFF's To a Clip     */
  2. /* By Bob Caron © 1995 NewTek Inc.                              */
  3.  
  4. parse arg InClipName","OutClipName","ignore1","ignore2
  5.  
  6. if ignore2="" then outclipname=inclipname
  7.  
  8. if ~show('l','rexxsupport.library') then do
  9.   if ~addlib('rexxsupport.library',0,-30,34) then do
  10.     call quit("RexxSupport Missing")
  11.   end
  12. end
  13.  
  14. Address "DigiPaint"
  15. options results
  16.  
  17.  
  18. if InClipName="" & OutClipName="" then do
  19.  'Askb'"This only works;from process clip."
  20.  exit
  21.  end
  22.  
  23. 'AskfBasename'
  24. if RC = 5 then call quit("Canceled!")
  25. IFFBaseName=Result
  26.  
  27. 'AskuStart IFF Frame #'
  28. if RC = 5 then call quit("Canceled!")
  29. StartFrame=strtoint(Result)
  30.  
  31. 'AskuEnd IFF Frame #'
  32. if RC = 5 then call quit("Canceled!")
  33. Endframe=strtoint(Result)
  34.  
  35. dots=0
  36. XWin = 100
  37. YWin = 40
  38. Clear = d2c(12)
  39. nv = ''
  40. cr = '0a'x
  41. call getfontsize
  42.  
  43. wid = width*48
  44. hei = theight+height*10
  45.  
  46. if ~open('Window','RAW:'XWin'/'YWin'/'wid'/'hei'/IFF2Clip Script V2.05 - CTRL-C to Abort/NOSIZE/SCREEN 'ps,'W') then exit
  47.  
  48. do i = StartFrame to EndFrame
  49.        Filename=IFFBaseName||Overlay(i,'000',4-Length(i))
  50.        call OpenWindow(filename,outclipname,i,endframe)
  51.        if exists(filename) then do
  52.           Call LoadRGB(filename)
  53.           'Apfc' /* Append a field */
  54.           'Apfc' /* Append a field */
  55.           end
  56.        end
  57. 'Iclp' /* Create the icon */
  58. exit
  59.  
  60.  
  61. quit:
  62. parse arg message
  63.  'Askb'message
  64. exit
  65.  
  66.  
  67. SetFile: PROCEDURE              /* Select file in current requester */
  68.   arg file
  69.   dirname=GetPathName(file)
  70.   'Dnam'dirname                 /* Enter file path  */
  71.  /* 'Dsel'*/                    /* Hit return on directory */
  72.   filename=GetFileName(file)
  73.   'Fnam'filename                /* Enter File name  */
  74.   'Okls'                        /* Hit the OK button  */
  75.   return
  76.  
  77. SaveRGB: PROCEDURE
  78.   arg filename
  79.   'Sa24'                /* Call file requester  */
  80.   Call SetFile(filename)
  81.   return
  82.  
  83. LoadRGB: PROCEDURE      /* Load Brush */
  84.   arg filename
  85.   'Lo24'                /* Call file requester  */
  86.   Call SetFile(filename)
  87.   return
  88.  
  89. GetFileName: procedure  /* Extract file name from full file specification */
  90.   ARG fullfile
  91.   c = lastpos("/",fullfile)
  92.   if c = 0 then c = lastpos(":",fullfile)
  93.   return substr(fullfile, c + 1)
  94.  
  95. GetPathName: procedure  /* Extract directory name from full file specification */
  96.   ARG fullfile
  97.   c = lastpos("/",fullfile)
  98.   if c = 0 then c = lastpos(":",fullfile)
  99.   return left(fullfile,c)
  100.  
  101. OpenWindow:
  102. parse arg framename,outclipname,frame,endframe
  103.   pdots="...."
  104.   dots=dots+1
  105.   if dots>4 then dots=1
  106.   call writech('Window',Clear||nv||cr)
  107.   call writech('Window','Current Source IFF  ['getfilename(Framename)']'cr)
  108.   call writech('Window','  Current Dest Clip ['getfilename(OutClipName)']'cr)
  109.   call writech('Window',''cr)
  110.   call writech('Window','Current Frame: 'Frame''cr)
  111.   call writech('Window','    End Frame: 'EndFrame''cr)
  112.   call writech('Window',''cr)
  113.   call writech('Window','Processing'right(pdots,dots)||cr)
  114. return
  115.  
  116. getfontsize:
  117. if open('font','env:sys/font.prefs','R') then do
  118.    font = readch('font',word(statef('env:sys/font.prefs'),2))
  119.    call close('font')
  120.    font = substr(font,index(font,'FONT')+4)
  121.    font = substr(font,index(font,'FONT')+4)
  122.    height = c2d(substr(font,29,2))
  123.    tfont = substr(font,index(font,'FONT')+4)
  124.    theight = c2d(substr(tfont,29,2))
  125.    font = substr(font,33)
  126.    font = left(font,index(font,d2c(0))-1-5)
  127.    if open('font','FONTS:'font'/'height,'R') then do
  128.       width = c2d(right(readch('font',116),2))
  129.       call close('font')
  130.   end
  131.   else if height=9 then width = 10
  132.                    else width = 8
  133. end
  134.   else do
  135.   theight = 8
  136.   height = 8
  137.   width = 8
  138. end
  139.  
  140. return
  141.  
  142. strtoint:
  143. arg numb
  144.  
  145. numb=cleanline(numb)
  146. total=0
  147.  
  148. do x=1 to length(numb)
  149. total=total+(abs(48-c2d(substr(numb,(length(numb)+1)-x,1)))*(10**(x-1)))
  150. end
  151.  
  152. return total
  153.  
  154. cleanline: /* Remove a wudge of non-alpha char's  */
  155. parse arg line
  156. line=translate(line,"","/*=:.;:<>+-!@#$%^&*()_|\[]{}?~`,")
  157. line=translate(line,"","abcdefghijklmnopqrstuvwxyz")
  158. line=translate(line,"","ABCDEFGHIJKLMNOPQRSTUVWXUZ")
  159. line=translate(line,"",d2c(34))
  160. line=translate(line,"",d2c(40))
  161. line=translate(line,"",d2c(41))
  162. line=translate(line,"",d2c(0))
  163. line=compress(line)
  164. return line
  165.